<!DOCTYPE HTML>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no, user-scalable=no">
		<script>
			var designW = 750,
				designH = 1346;
			var windowW = window.innerWidth,
				windowH = window.innerHeight;
			var scaleX = windowW / designW,
				scaleY = windowH / designH;
			var scale = Math.min(scaleX, scaleY);
			// var htmlEle = document.querySelector('html');
			// htmlEle.style.transform = 'scale(' + scale + ')';
			var metaTags = document.getElementsByTagName('meta');
			for (var i = 0; i < metaTags.length; i++) {
				// 判断当前元素是否为 viewport 相关的 meta 标签
				if (metaTags[i].getAttribute("name") === "viewport") {
					// 设置新的 initial-scale 值
					metaTags[i].setAttribute(
						"content",
						"width=device-width, shrink-to-fit=no, user-scalable=no, initial-scale=" + scale
					);
					break; // 只需修改第一个符合条件的 meta 标签，因此跳出循环
				}
			}
		</script>
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="renderer" content="webkit">
		<title>绝版19沃派卡</title>
		<meta name="description" content="绝版19沃派卡" />
		<meta name="keywords" content="" />
		<link rel="stylesheet" href="./picker.css">
		<style>
			* {
				margin: 0;
				padding: 0;
				box-sizing: border-box;
			}

			body {
				padding: 40px 0;
				font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
				user-select: none;
				-webkit-user-select: none;
				display: flex;
				flex-direction: column;
				align-items: center;
				background: linear-gradient(180deg, #05c9fd 0, #05c9fd 800px, #0568fd 900px, #0568fd 100%);
			}

			.mainBox {
				width: 100%;
				max-width: 750px;
				display: flex;
				flex-direction: column;
				align-items: center;
			}

			.mainBox .topBox {
				width: 100%;
				position: relative;
			}

			.mainBox .topBox .topTable {
				width: calc(100% - 24px);
				max-width: 726px;
				position: absolute;
				left: 12px;
				bottom: -68px;
			}

			.mainBox .addrBox {
				margin-top: 88px;
				padding: 0 30px;
				width: 100%;
				max-width: 710px;
				background: #FFFFFF;
				border-radius: 24px;
				box-shadow: 0 0 10px #05c9fd;
				display: flex;
				flex-direction: column;
				align-items: center;
			}

			.mainBox .addrBox .addrTitle {
				margin-bottom: 20px;
				width: 100%;
				font-weight: 500;
				font-size: 32px;
				color: #202020;
				text-align: center;
			}

			.mainBox .addrBox .addrTitle img {
				margin-top: 40px;
				width: auto;
				height: 66px;
			}

			.mainBox .addrBox .addrRow {
				padding: 12px 0;
				width: 100%;
				height: 86px;
				border-bottom: 1px solid #F0F0F0;
				display: flex;
				flex-direction: row;
				justify-content: space-between;
				align-items: center;
			}

			.mainBox .addrBox .addrRow:nth-child(5) {
				border-bottom: none;
			}

			.mainBox .addrBox .addrRow .rowName {
				width: 128px;
				font-weight: 400;
				font-size: 24px;
				color: #545458;
				line-height: 2;
			}

			.mainBox .addrBox .addrRow .rowInput {
				width: calc(100% - 128px);
				position: relative;
			}

			.mainBox .addrBox .addrRow .rowInput>input,
			.mainBox .addrBox .addrRow .rowInput>.select-btn>input {
				padding: 0 10px;
				width: calc(100% - 20px);
				border: none;
				font-weight: 400;
				font-size: 24px;
				line-height: 2;
			}

			.mainBox .addrBox .addrRow .rowInput>input:focus,
			.mainBox .addrBox .addrRow .rowInput>input:active,
			.mainBox .addrBox .addrRow .rowInput>.select-btn>input:focus,
			.mainBox .addrBox .addrRow .rowInput>.select-btn>input:active {
				border: none;
			}


			.mainBox .addrBox .addrRow .rowInput>.select-btn {
				border: none;
				padding: 0;
				width: 100%;
				height: 100%;
				border: none;
			}

			.mainBox .addrBox .addrRow .rowInput>.select-btn::after {
				width: 12px;
				height: 12px;
				top: 16px;
			}

			.mainBox .addrBox .applyNote {
				margin-top: 16px;
				padding: 26px 28px;
				width: 100%;
				background: #FFF6D7;
				border-radius: 16px;
			}

			.mainBox .addrBox .applyNote .noteTitle {
				font-weight: bold;
				font-size: 24px;
				color: #EE302F;
			}

			.mainBox .addrBox .applyNote .noteInfo {
				margin-top: 12px;
				font-weight: 400;
				font-size: 24px;
				color: #818387;
				line-height: 36px;
			}

			.mainBox .addrBox .applyBtn {
				margin: 28px 0 36px 0;
			}

			.mainBox .addrBox .applyBtn>button {
				width: 100%;
				padding: 0;
				margin: 0;
				border: none;
				background: transparent;
			}

			.mainBox .addrBox .applyBtn>button:active>img {
				opacity: 0.8;
			}


			.mainBox .deviceBox {
				margin-top: 20px;
				padding: 0 30px;
				width: 100%;
				max-width: 710px;
				height: 460px;
				background: #FFFFFF;
				border-radius: 24px;
				box-shadow: 0 0 10px #05c9fd;
				display: flex;
				flex-direction: column;
				align-items: center;
			}

			.mainBox .deviceBox .deviceTitle {
				margin-bottom: 30px;
				width: 100%;
				font-weight: 500;
				font-size: 32px;
				color: #202020;
				text-align: center;
			}

			.mainBox .deviceBox .deviceTitle img {
				margin-top: 40px;
				width: auto;
				height: 66px;
			}

			.mainBox .deviceBox .deviceRow {
				padding: 20px;
				width: 100%;
				height: 280px;
				background: #F5F5F5;
				border-radius: 16px;
				display: flex;
				flex-direction: row;
				justify-content: space-between;
				align-items: center;
			}

			.mainBox .deviceBox .left {
				width: 240px;
				height: 240px;
				border-radius: 12px;
				background: #fff;
			}

			.mainBox .deviceBox .right {
				padding-left: 20px;
				width: calc(100% - 240px);
				display: flex;
				flex-direction: column;
			}

			.mainBox .deviceBox .right .name {
				width: 100%;
				font-weight: bold;
				font-size: 32px;
				color: #0B2238;
				overflow: hidden;
				text-overflow: ellipsis;
				white-space: nowrap;
			}

			.mainBox .deviceBox .right .tip {
				width: 100%;
				font-weight: 400;
				font-size: 28px;
				color: #736124;
				overflow: hidden;
				text-overflow: ellipsis;
				white-space: nowrap;
			}

			.mainBox .deviceBox .right .sub {
				margin-top: 10px;
				width: 100%;
				font-weight: 400;
				font-size: 24px;
				color: #7A858E;
				line-height: 30px;
				overflow: hidden;
				text-overflow: ellipsis;
				display: -webkit-box;
				-webkit-line-clamp: 2;
				word-break: break-all;
				-webkit-box-orient: vertical;
			}

			.mainBox .deviceBox .right .priceBtn {
				margin-top: 20px;
				width: 100%;
				display: flex;
				flex-direction: row;
				justify-content: space-between;
				align-items: center;
			}

			.mainBox .deviceBox .right .price {
				display: flex;
				flex-direction: row;
				align-items: baseline;
				font-weight: 400;
				font-size: 24px;
				color: #0B2238;
			}

			.mainBox .deviceBox .right .btn {
				width: 184px;
				height: 64px;
				background: linear-gradient(90deg, #F71D01 0%, #FA5706 100%);
				border-radius: 32px;
				display: flex;
				flex-direction: row;
				justify-content: center;
				align-items: center;
				font-weight: 400;
				font-size: 24px;
				color: #FFFFFF;
			}

			.mainBox .stepBox {
				margin-top: 20px;
				width: calc(100% - 22px);
				max-width: 728px;
				border-radius: 24px;
				overflow: hidden;
				display: flex;
				flex-direction: column;
			}
		</style>
	</head>
	<body>
		<div class="mainBox">
			<div class="topBox">
				<img src="./head.jpg" width="100%" alt="沃派卡" />
				<img class="topTable" src="./taocan.png" width="100%" alt="套餐详情" />
			</div>
			<div class="addrBox">
				<div class="addrTitle">
					<img src="./addtit.png" height="100%" alt="推荐使用上网设备" />
				</div>
				<div class="addrRow">
					<div class="rowName">收件人:</div>
					<div class="rowInput">
						<input id="username" type="text" placeholder="请输入收件人" autoComplete="false">
					</div>
				</div>
				<div class="addrRow">
					<div class="rowName">联系方式:</div>
					<div class="rowInput">
						<input id="phone" type="tel" placeholder="请输入联系方式" autoComplete="false">
					</div>
				</div>
				<div class="addrRow">
					<div class="rowName">所在地区:</div>
					<div class="rowInput">
						<div id="selectBtn" class="select-btn">
							<input id="cityPicker" type='text' placeholder='请选择省市区' readonly />
						</div>
					</div>
				</div>
				<div class="addrRow">
					<div class="rowName">详细地址:</div>
					<div class="rowInput">
						<input id="address" type="text" placeholder="请输入详细地址" autoComplete="false">
					</div>
				</div>
				<div class="applyNote">
					<div class="noteTitle">温馨提示:</div>
					<div class="noteInfo">
						<p>1. 每人限领一张，需年满18周岁并持有有效身份证，</p>
						<p>2. 绝版套餐仅限非联通用户领取，</p>
						<p>3. 领取费用激活后自动转为预存。</p>
					</div>
				</div>
				<div class="applyBtn">
					<button type="button" class="button" id="onApply">
						<img src="./buy.gif" width="100%" alt="立即办理" />
					</button>
				</div>
			</div>
			<div class="deviceBox" id="app">
				<div class="deviceTitle">
					<img src="./devicetit.png" height="100%" alt="线上领取" />
				</div>
				<div class="deviceRow">
					<div class="left">
						<img :src="proDetail.thumb_image" width="100%" height="100%" alt="" />
					</div>
					<div class="right">
						<div class="name">{{proDetail.product_name}}</div>
						<div class="tip">月享1500GB 小巧便携</div>
						<div class="sub">适用室内、户外各种灵活连网 需求</div>
						<div class="priceBtn">
							<div class="price">包年<span style="color: #FF1800;font-weight: bold;">￥</span><span
									style="color: #FF1800;font-weight: bold;font-size: 32px;">{{proDetail.sales_price}}</span></div>
							<div class="btn" id="toProDetail">&nbsp;&nbsp;立即办理 〉</div>
						</div>
					</div>
				</div>
			</div>
			<div class="stepBox">
				<img src="./why.png" width="100%" alt="为什么" />
			</div>
		</div>

		<div class="picker-mask" id="pickerMask"></div>
		<div class="picker-container" id="pickerContainer">
			<div class="picker-header">
				<div class="picker-title">选择省市区</div>
				<button class="picker-close" id="pickerClose">完成</button>
			</div>
			<div class="picker-content" id="pickerContent"></div>
		</div>
		<script src="https://code.jquery.com/jquery-1.12.4.min.js"> </script>
		<script src="vue@v2.7.16.js"></script>
		<script src="cities.js"></script>
		<script src="picker.js"></script>
		<script type="text/javascript">
			var app = new Vue({
				el: '#app',
				data: {
					proDetail: {},
				},
				methods: {
					initProDetail: function() {
						const self = this;
						$.ajax({
							url: "https://wkh.wokahui.cn/api/ad/get_product",
							type: "GET",
							dataType: "json",
							timeout: 6000,
							beforeSend: function(xhr) {
								// 可选，发送请求前执行（如添加请求头、显示加载动画）
								console.log("准备发送请求...");
							},
							success: function(response) {
								// 必需，请求成功时执行（response 是服务器返回的数据）
								console.log("请求成功：", response);
								if (response.code == 0 && response.data && response.data.id) {
									self.proDetail = response.data;
								} else {
									layer.msg(response.msg || "查询产品出错", {
										title: '温馨提示',
										time: 1500
									})
								}
							},
							error: function(xhr, status, error) {
								// 可选，请求失败时执行（如网络错误、服务器错误）
								console.log("请求失败：", status, error);
							},
							complete: function(xhr, status) {
								// 可选，请求完成后执行（无论成功或失败，如隐藏加载动画）
								console.log("请求结束");
							}
						});
					}
				}
			});
			let username, phone, city, adderess;
			$(document).ready(function() {
				$("#onApply").click(function() {
					console.log('onApply');
					username = document.getElementById("username").value;
					phone = document.getElementById("phone").value;
					city = document.getElementById("cityPicker").value;
					address = document.getElementById("address").value;
					console.log(username, phone, city, address);
					onOrder();
				});
				app.initProDetail();
				$("#toProDetail").click(function() {
					console.log('toProDetail');
					window.location.href = "file:///D:/ZhangKui/projects/high_flow_cards/pages/web/wopaika/detail.html";
				});
			});

			function onOrder() {
				console.log('onOrder');
				if (!username) {
					alert("请输入收件人!");
					return;
				}
				if (!phone) {
					alert("请输入联系方式!");
					return;
				}
				const regex = /^1[3-9]\d{9}$/; // 中国大陆手机号码的正则表达式
				if (!regex.test(phone)) {
					alert("请检查联系方式!");
					return;
				}
				if (!city) {
					alert("请选择省市区!");
					return;
				}
				if (!address) {
					alert("请输入详细地址!");
					return;
				}
				$.ajax({
					url: "https://chat.wokahui.com/claim/index/put_order",
					type: "POST",
					data: {
						name: username,
						tel: phone,
						province: city[0],
						city: city[1],
						county: city[2],
						address: address,
					},
					dataType: "json",
					timeout: 6000,
					beforeSend: function(xhr) {
						// 可选，发送请求前执行（如添加请求头、显示加载动画）
						console.log("准备发送请求...");
					},
					success: function(response) {
						// 必需，请求成功时执行（response 是服务器返回的数据）
						console.log("请求成功：", response);
					},
					error: function(xhr, status, error) {
						// 可选，请求失败时执行（如网络错误、服务器错误）
						console.log("请求失败：", status, error);
					},
					complete: function(xhr, status) {
						// 可选，请求完成后执行（无论成功或失败，如隐藏加载动画）
						console.log("请求结束");
					}
				});

			}

			function onPaying() {}

			function onComplete() {
				window.location.href = "file:///D:/ZhangKui/projects/high_flow_cards/complete.html";
			}
		</script>

	</body>
</html>